﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.Utils
{
    //todo: Petre Doubled with another ClientDW
    //anyway should be removed
    public static class UnitTestDetector
    {
        static UnitTestDetector()
        {
            List<string> testAssemblyNames = new List<string>() { "Microsoft.VisualStudio.QualityTools.UnitTestFramework", "xunit.runner" };

            IsInUnitTest = testAssemblyNames.Any(assemblyName => AppDomain.CurrentDomain.GetAssemblies().Any(a => a.FullName.StartsWith(assemblyName)));
        }

        public static bool IsInUnitTest { get; private set; }
    }
}
